using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UpSceneHiddenDoorTrigger : TriggerBase
{
    [SerializeField] private SpriteRenderer _spriteRenderer;
    [SerializeField] private int _weaponSelectCount = 2;
    [SerializeField] private WeaponScrollDataListSO _weaponScrollDataListSO;
    private List<WeaponScrollDataSO> _selectedWepaon = new();
    private bool _canInteract = true;
    protected override void OnTriggerEnter2D(Collider2D other)
    {
        base.OnTriggerEnter2D(other);

        if (other.CompareTag("Player") == false || _canInteract == false)
            return;
        _spriteRenderer.sortingOrder = 10;

        PlayerInventory playerInventory = other.GetComponent<PlayerInventory>();
        
        _selectedWepaon = playerInventory.GetCanSelectWeapon(_weaponScrollDataListSO, _weaponSelectCount);
        EventCenter.TriggerEvent(EventName.UI_OpenWeaponSelectPanel, _selectedWepaon);
        
        _canInteract = false;
    }
}
